// 关联泛型
type User = {
  readonly id: number,
  name: string
  tel: string
  address?: string
}

// 比如挑选name和tel属性,形成下面的类型

type UserPick = {
  name: string
  tel: string
}

// function myPick(obj, key) {
//   // todos...
//   return {}
// }

type MyPick<T, K extends keyof T> = {
  [key in K]: T[key]
}

type PickUser = MyPick<User, "name" | "address">

let u: PickUser = {
  name: "jack",
  address: "苏州",
}